Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initiate reconnect when server stops sending data #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jahqueel
Copy link
Contributor

If the server stops responding to pings (or anything else) while CONNECTED, the library doesn't notice until a TCP timeout occurs, which takes much longer than the sessionTimeout. It's possible to reproduce this via iptables:

iptables -I INPUT 1 -s current_zk_ip -j DROP

The java library tracks when it last received a message from the server, and disconnects when it's been longer than the session timeout.

This patch replicates that functionality.

If there is a network connectivity issue with the server, we could end
up waiting for a TCP timeout before detecting that our pings are not
being responded to.

Instead, let's keep track of the last time the server sent us a message
and initiate a reconnect if we haven't received anything within a
sessionTimeout interval.
@jahqueel
Copy link
Contributor Author

This may mitigate #16 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant